/**
 * 
 */
package com.huarui.desktop.dao.impl;

import java.util.HashMap;
import java.util.List;

import org.ewaf.framework.dao.impl.BaseSimpleDao;

import com.huarui.desktop.dao.DesktopJsModuleDao;
import com.huarui.desktop.model.DesktopJsModule;
import com.huarui.companypackage.model.Service;

/**
 * @author peng.sunp
 * 
 */
public class DesktopJsModuleDaoImpl extends BaseSimpleDao implements
		DesktopJsModuleDao {

	@SuppressWarnings("unchecked")
	public List<Integer> selectPermissionId4User(Integer employeeId){
		HashMap<String, Integer> params = new HashMap<String, Integer>();
		params.put("employeeId", employeeId);
		params.put("serviceTarget", Service.SERVICE_TARGET_COMMON_USER);
		return (List<Integer>) getSqlMapClientTemplate().queryForList(
				namespace + ".selectPermissionId4User", params);
	}
	
	/*
	 * (non-Javadoc)
	 * @see com.huarui.desktop.dao.DesktopJsModuleDao#selectDesktopJsModules4User(java.lang.Integer, java.lang.Integer)
	 */
	@SuppressWarnings("unchecked")
	@Override
	public List<DesktopJsModule> selectDesktopJsModules4User(Integer desktopId,
			Integer employeeId) {
		HashMap<String, Integer> params = new HashMap<String, Integer>();
		params.put("desktopId", desktopId);
		params.put("employeeId", employeeId);
		params.put("serviceTarget", Service.SERVICE_TARGET_COMMON_USER);
		return (List<DesktopJsModule>) getSqlMapClientTemplate().queryForList(
				namespace + ".selectDesktopJsModule4User", params);
	}

	public void insertDesktopJsModule(DesktopJsModule desktopJsModule){
		getSqlMapClientTemplate().insert(namespace + ".insertDesktopJsModule", desktopJsModule);
	}
	
	public void deleteAllDesktopJsModule(){
		getSqlMapClientTemplate().delete(namespace + ".deleteAllDesktopJsModule");

	}
}
